<template>
  <a-sub-menu :key="menuInfo.key">
    <template #icon>
      <IconAntdv :icon="menuInfo.icon" />
    </template>
    <template #title>{{ menuInfo.name }}</template>
    <template v-for="item in menuInfo.children" :key="item.id">
      <template v-if="!item.children">
        <a-menu-item :key="item.key">
          <template #icon>
            <IconAntdv :icon="item.icon" />
          </template>
          {{ item.name }}
        </a-menu-item>
      </template>
      <template v-else>
        <sub-menu :menu-info="item" :key="item.key" />
      </template>
    </template>
  </a-sub-menu>
</template>

<script>
import { defineComponent } from 'vue'

export default defineComponent({
  name: 'SubMenu',
  props: {
    menuInfo: {
      type: Object,
      default: () => ({})
    }
  }
})
</script>
